<?php
/**
 * 检查路由绑定的 {appid} 参数是否存在对应的 authorizer
 *
 * Author: Zeon
 * Date: 2017/11/24
 * Created by Panxsoft.
 */
namespace App\Http\Requests\OpenWechat\Authorizer;

use Illuminate\Validation\Rule;

/**
 * @property string redirect_url
 * @property string scope
 * @property string appid
 */
class OauthRequest extends AuthorizerAppidRequest
{
    const SCOPE_BASE = 'snsapi_base';
    const SCOPE_USER_INFO = 'snsapi_userinfo';

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'redirect_url' => 'required',
            'scope' => [
                'nullable',
                Rule::in([self::SCOPE_BASE, self::SCOPE_USER_INFO])
            ]
        ];
    }
}
